<?php

declare(strict_types=1);

namespace App\Controller\Rpc;
use App\Controller\AbstractController;
use Hyperf\HttpServer\Annotation\Controller;
use Hyperf\HttpServer\Annotation\RequestMapping;
use Hyperf\RateLimit\Annotation\RateLimit;
use Hyperf\Cache\Annotation\Cacheable;
use Hyperf\HttpServer\Contract\RequestInterface;
use App\Event\RateLimitCallBack;

/**
 * 测试用户
 * @Controller(prefix="/Rpc/User")
 * RateLimit(limitCallback={RateLimitCallBack::class, "limitCallback"})
 */
class UserController extends AbstractController
{
    /**
     * @RequestMapping(path="getUserInfo",method="GET")
     * RateLimit(create=1, capacity=1)
     * Cacheable(prefix="xiaochen",ttl=5,value="_#{id}",key="指定的key")//一般情况下根据url地址进行缓存，如果需要指定的话，需要用key
     */
    public function getUserInfo(RequestInterface $request)
    {
        return "OK";
    }
}